Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-0 vector-toc-not-available vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-0 vector-feature-night-mode-enabled skin-theme-clientpref-os vector-sticky-header-enabled" lang="fr" dir="ltr"><head>
<meta charset="UTF-8">
<title>Spring (framework)</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="./_res_/favicon.png">
<link rel="canonical" href="https://fr.wikipedia.org/wiki/Spring_(framework)"> <link href="./_mw_/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./_mw_/ext.wikimediamessages.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./_mw_/skins.vector.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./_mw_/site.styles.css">
<link rel="stylesheet" type="text/css" href="./_mw_/noscript.css">
<link rel="stylesheet" type="text/css" href="./_res_/footer.css">
<link rel="stylesheet" type="text/css" href="./_res_/vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Spring_framework rootpage-Spring_framework skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Spring (framework)</span></h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="contentSub">
<div id="mw-content-subtitle"></div>
</div>
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="fr" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="fr" dir="ltr">
<div class="infobox_v3 infobox infobox--frwiki noarchive" style="width:260px">
<div class="entete icon informatique" style="background-color: #5EB832; color: #000000;"><style data-mw-deduplicate="TemplateStyles:r228712691">
/* start https://fr.wikipedia.org/ */


.mw-parser-output .entete.informatique{background-image:url("./_mw_/Picto.nfo.png")}


/* end https://fr.wikipedia.org/ */
</style>
<div><span style="color: #fff;">Spring Framework</span></div>
</div>
<div class="images">
</div>
<p class="mw-empty-elt">

</p>
<table><caption style="background-color:#5EB832;color:#000000;">Informations</caption>



<tbody><tr>
<th scope="row"><a href="D%C3%A9veloppeur" title="Développeur">Développé par</a></th>
<td>
<span class="wd_p178"><a href="VMware" title="VMware">VMware</a></span></td>
</tr>



<tr>
<th scope="row"> <a href="Version_d'un_logiciel" title="Version d'un logiciel">Première version</a>
</th>
<td>
<time class="nowrap date-lien" datetime="2003-06-25" data-sort-value="2003-06-25"><a href="25_juin" title="25 juin">25</a> <a href="Juin_2003" title="Juin 2003">juin</a> <a href="2003_en_informatique" title="2003 en informatique">2003</a></time><sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup></td>
</tr>

<tr>
<th scope="row"> <a href="Version_d'un_logiciel" title="Version d'un logiciel">Dernière version</a>
</th>
<td>
<span class="wd_p348">6.2.9 (<time class="nowrap" datetime="2025-07-17" data-sort-value="2025-07-17">17 juillet 2025</time>)<sup id="cite_ref-wikidata-b3f0a75700a7c62930bf309092fbc24931b80daf_2-0" class="reference"><a href="#cite_note-wikidata-b3f0a75700a7c62930bf309092fbc24931b80daf-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup></span></td>
</tr>



<tr>
<th scope="row"><a href="D%C3%A9p%C3%B4t_(informatique)" title="Dépôt (informatique)">Dépôt</a></th>
<td>
<span class="wd_p1324"><a rel="nofollow" class="external text" href="https://github.com/spring-projects/spring-framework">github.com/spring-projects/spring-framework</a></span></td>
</tr>





<tr>
<th scope="row"> <a href="Langage_de_programmation" title="Langage de programmation">Écrit en</a>
</th>
<td>
<span class="wd_p277"><a href="Java_(langage)" title="Java (langage)">Java</a>, <a href="Kotlin_(langage)" title="Kotlin (langage)">Kotlin</a> et <a href="Groovy_(langage)" title="Groovy (langage)">Groovy</a></span></td>
</tr>





<tr>
<th scope="row"><a href="Syst%C3%A8me_d'exploitation" title="Système d'exploitation">Système d'exploitation</a></th>
<td>
<span class="wd_p306">Multiplateforme <small>(<a href="https://www.wikidata.org/wiki/Q174666" class="extiw external" title="d:Q174666"><span class="indicateur-langue" title="Voir l'élément Wikidata correspondant">d</span></a>)</small></span></td>
</tr>

<tr>
<th scope="row"><a href="Plateforme_informatique" title="Plateforme informatique">Environnement</a></th>
<td>
<a href="Multiplate-forme" class="mw-redirect" title="Multiplate-forme">Multiplate-forme</a></td>
</tr>









<tr>
<th scope="row"> Type
</th>
<td>
<span class="wd_p31"><a href="Framework_Web" title="Framework Web">Framework web</a><br><a href="Framework" title="Framework">Framework</a><br>Bibliothèque Java <small>(<a href="https://www.wikidata.org/wiki/Q21127166" class="extiw external" title="d:Q21127166"><span class="indicateur-langue" title="Voir l'élément Wikidata correspondant">d</span></a>)</small></span></td>
</tr>



<tr>
<th scope="row"><a href="Licence_de_logiciel" title="Licence de logiciel">Licence</a></th>
<td>
<span class="wd_p275"><a href="Licence_Apache" title="Licence Apache">Licence Apache 2.0</a></span></td>
</tr>



<tr>
<th scope="row"><a href="Site_web" title="Site web">Site web</a></th>
<td>
<span class="wd_p856"><a rel="nofollow" class="external text" href="https://spring.io/projects/spring-framework">spring.io/projects/spring-framework</a></span></td>
</tr>

</tbody></table>
<p class="mw-empty-elt">

</p>
</div>
<p>En <a href="Informatique" title="Informatique">informatique</a>, <b>Spring</b> est un <a href="Framework" title="Framework">framework</a> <a href="Open_source" title="Open source">open source</a> pour construire et définir l'infrastructure d'une application <a href="Java_(technique)" title="Java (technique)">Java</a><sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>, dont il facilite le <a href="D%C3%A9veloppement_de_logiciel" title="Développement de logiciel">développement</a> et les tests.
</p><p>En 2004, Rod Johnson&nbsp;<a href="https://en.wikipedia.org/wiki/Rod_Johnson_(programmer)" class="extiw external" title="en:Rod Johnson (programmer)"><span class="indicateur-langue" title="Article en anglais&nbsp;: «&nbsp;Rod Johnson (programmer)&nbsp;»">(en)</span></a> a écrit le livre <i><span class="lang-en" lang="en">Expert One-on-One J2EE Design and Development</span></i><sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> qui explique les raisons de la création de Spring.
</p>

<div class="mw-heading mw-heading2"><h2 id="Conteneur_léger"><span id="Conteneur_l.C3.A9ger"></span>Conteneur léger</h2></div>
<p>Spring est considéré comme un conteneur dit «&nbsp;léger&nbsp;». La raison de ce nommage est expliquée par Erik Gollot dans l’introduction du document <i>Introduction au framework Spring</i><sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup>.
</p>
<blockquote>
<p>«&nbsp;Spring est effectivement un conteneur dit «&nbsp;léger&nbsp;», c’est-à-dire une infrastructure similaire à un <a href="Serveur_d'applications" title="Serveur d'applications">serveur d'applications</a> <a href="Java_EE" class="mw-redirect" title="Java EE">J2EE</a>. Il prend donc en charge la création d’objets et la mise en relation d’objets par l’intermédiaire d’un fichier de configuration qui décrit les objets à fabriquer et les relations de dépendances entre ces objets. Le gros avantage par rapport aux serveurs d’application est qu’avec Spring, les classes n’ont pas besoin d’implémenter une quelconque interface pour être prises en charge par le framework (au contraire des <a href="Serveur_d'applications" title="Serveur d'applications">serveurs d'applications</a> <a href="Java_EE" class="mw-redirect" title="Java EE">J2EE</a> et des <a href="Enterprise_JavaBeans" title="Enterprise JavaBeans">EJBs</a>). C’est en ce sens que Spring est qualifié de conteneur «&nbsp;léger&nbsp;».&nbsp;»
</p>
</blockquote>
<p>Spring s’appuie principalement sur l’intégration de trois concepts clés&nbsp;:
</p>
<ol><li>L’<a href="Inversion_de_contr%C3%B4le" title="Inversion de contrôle">inversion de contrôle</a> est assurée de deux façons différentes&nbsp;: la recherche de dépendances et l'<a href="Injection_de_d%C3%A9pendances" title="Injection de dépendances">injection de dépendances</a>&nbsp;;</li>
<li>La <a href="Programmation_orient%C3%A9e_aspect" title="Programmation orientée aspect">programmation orientée aspect</a>&nbsp;;</li>
<li>Une couche d’abstraction.</li></ol>
<p>La couche d’abstraction permet d’intégrer d’autres <a href="Framework" title="Framework">frameworks</a> et <a href="Biblioth%C3%A8que_logicielle" title="Bibliothèque logicielle">bibliothèques</a> avec une plus grande facilité. Cela se fait par l’apport ou non de couches d’abstraction spécifiques à des frameworks particuliers. Il est ainsi possible d’intégrer un module d’envoi de mails plus facilement.
</p><p>L’<a href="Inversion_de_contr%C3%B4le" title="Inversion de contrôle">inversion de contrôle</a>&nbsp;:
</p>
<ol><li>La recherche de dépendance&nbsp;: consiste pour un objet à interroger le conteneur, afin de trouver ses dépendances avec les autres objets. C’est un cas de fonctionnement similaire aux EJBs&nbsp;;</li>
<li>L’<a href="Injection_de_d%C3%A9pendances" title="Injection de dépendances">injection de dépendances</a>&nbsp;: cette injection peut être effectuée de trois manières possibles&nbsp;:
<ul><li>l’injection de dépendance via le constructeur,</li>
<li>l’injection de dépendance via les modificateurs (setters),</li>
<li>l’injection de dépendance via une interface.</li></ul></li></ol>
<p>Les deux premières sont les plus utilisées par Spring.
</p><p>Ce framework, grâce à sa couche d’abstraction, ne concurrence pas d’autres frameworks dans une couche spécifique d’un modèle architectural <a href="Mod%C3%A8le-Vue-Contr%C3%B4leur" class="mw-redirect" title="Modèle-Vue-Contrôleur">Modèle-Vue-Contrôleur</a> mais s’avère être un framework multi-couches pouvant s’insérer au niveau de toutes les couches&nbsp;; modèle, vue et contrôleur. Ainsi il permet d’intégrer <a href="Hibernate" title="Hibernate">Hibernate</a> ou <a href="IBATIS" title="IBATIS">iBATIS</a> pour la couche de persistance ou encore <a href="Apache_Struts" title="Apache Struts">Struts</a> et <a href="JavaServer_Faces" title="JavaServer Faces">JavaServer Faces</a> pour la couche présentation.
</p>
<div class="mw-heading mw-heading2"><h2 id="Composition_de_Spring">Composition de Spring</h2></div>
<div class="mw-heading mw-heading3"><h3 id="Noyau_de_base">Noyau de base</h3></div>
<p>Le noyau de Spring est basé sur&nbsp;:
</p>
<ul><li>une <a href="Fabrique_abstraite_(motif_de_conception)" class="mw-redirect" title="Fabrique abstraite (motif de conception)">fabrique</a> générique de composants informatiques, composants nommés <a href="JavaBeans" title="JavaBeans">beans</a> (anglais de <i>haricots</i>, et dans le contexte Java de&nbsp;<i>grain&nbsp;de&nbsp;café</i>)&nbsp;;</li>
<li>un conteneur capable de stocker ces beans.</li></ul>
<p>De plus, le noyau de Spring permet de forcer le contrôle de ces composants de leur extérieur, par la technique nommée <a href="Inversion_de_contr%C3%B4le" title="Inversion de contrôle">inversion de contrôle</a>.
</p><p>Le principal avantage est de composer les beans de façon plus déclarative plutôt que de façon impérative dans le programme. Les beans peuvent être définis par le biais de <a href="Fichier_de_configuration" title="Fichier de configuration">fichiers de configuration</a> en Java ou <a href="Extensible_Markup_Language" title="Extensible Markup Language">XML</a>.
</p>
<div class="mw-heading mw-heading4"><h4 id="Exemple_d'utilisation"><span id="Exemple_d.27utilisation"></span>Exemple d'utilisation</h4></div>
<p>Dans l'exemple ci-dessous, deux beans <a href="Singleton_(motif_de_conception)" class="mw-redirect" title="Singleton (motif de conception)">singletons</a> sont définis. Le premier est un <a href="Objet_d'acc%C3%A8s_aux_donn%C3%A9es" title="Objet d'accès aux données">objet d'accès aux données</a> pour des produits et on l'injecte dans le second qui est un gestionnaire de produits.
</p>
<div class="mw-highlight mw-highlight-lang-java mw-content-ltr" dir="ltr"><pre><span></span><span class="nd">@Configuration</span>
<span class="kd">public</span><span class="w"> </span><span class="kd">class</span> <span class="nc">AppConfig</span><span class="w"> </span><span class="p">{</span>

<span class="w"> </span><span class="nd">@Bean</span>
<span class="w"> </span><span class="kd">public</span><span class="w"> </span><span class="n">ClientService</span><span class="w"> </span><span class="nf">clientService</span><span class="p">(</span><span class="n">ClientDao</span><span class="w"> </span><span class="n">clientDao</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="n">ClientService</span><span class="w"> </span><span class="n">clientService</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">ClientServiceImpl</span><span class="p">();</span>
<span class="w"> </span><span class="n">clientService</span><span class="p">.</span><span class="na">setClientDao</span><span class="p">(</span><span class="n">clientDao</span><span class="p">);</span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">clientService</span><span class="p">;</span>
<span class="w"> </span><span class="p">}</span>

<span class="w"> </span><span class="nd">@Bean</span>
<span class="w"> </span><span class="kd">public</span><span class="w"> </span><span class="n">ClientDao</span><span class="w"> </span><span class="nf">clientDao</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">ClientDaoImpl</span><span class="p">();</span>
<span class="w"> </span><span class="p">}</span>
<span class="p">}</span>
</pre></div>
<p>Par exemple, lors d'une recherche, on demandera au conteneur Spring de fournir le gestionnaire de produits qui utilisera l'objet d'accès aux données.
</p>
<div class="mw-heading mw-heading3"><h3 id="Compléments"><span id="Compl.C3.A9ments"></span>Compléments</h3></div>
<p>Divers modules Spring Framework viennent en complément du noyau de base pour permettre l'intégration avec les autres bibliothèques et framework, notamment&nbsp;:
</p>
<ul><li><i>Accès et intégration des données</i> pour l'intégration de JDBC, des <a href="Mapping_objet-relationnel" title="Mapping objet-relationnel">ORM</a>, de la <a href="S%C3%A9rialisation" title="Sérialisation">sérialisation</a> des données, de <a href="Java_Message_Service" title="Java Message Service">JMS</a> et des <a href="Transaction_informatique" title="Transaction informatique">transactions</a>&nbsp;;</li>
<li><i>AOP et instrumentation</i> pour la <a href="Programmation_orient%C3%A9e_aspect" title="Programmation orientée aspect">programmation par aspects</a> (<a href="AspectJ" title="AspectJ">AspectJ</a>)&nbsp;;</li>
<li><i>Web</i> pour la réalisation d'applications web avec les technologies <a href="Servlet" title="Servlet">Servlet</a> et <a href="WebSocket" title="WebSocket">websocket</a>&nbsp;;</li>
<li><i>Test</i> pour l'intégration avec des frameworks de test comme <a href="JUnit" title="JUnit">JUnit</a> ou <a href="TestNG" title="TestNG">TestNG</a>.</li></ul>
<div class="mw-heading mw-heading2"><h2 id="Notes_et_références"><span id="Notes_et_r.C3.A9f.C3.A9rences"></span>Notes et références</h2></div>
<div class="references-small decimal" style=""><div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a> </span><span class="reference-text"><a rel="nofollow" class="external free" href="https://src.springsource.org/svn/spring-maintenance/tags/release-1-0/changelog.txt">https://src.springsource.org/svn/spring-maintenance/tags/release-1-0/changelog.txt</a></span>
</li>
<li id="cite_note-wikidata-b3f0a75700a7c62930bf309092fbc24931b80daf-2"><span class="mw-cite-backlink"><a href="#cite_ref-wikidata-b3f0a75700a7c62930bf309092fbc24931b80daf_2-0">↑</a> </span><span class="reference-text"><span class="ouvrage" id="spring-projects"><abbr class="abbr indicateur-langue" title="Langue : anglais">(en)</abbr> spring-projects, «&nbsp;<a rel="nofollow" class="external text" href="https://github.com/spring-projects/spring-framework/releases/tag/v6.2.9"><cite style="font-style:normal;" lang="en"><span class="lang-en" lang="en">Release v6.2.9 · spring-projects/spring-framework</span></cite></a>&nbsp;» <small style="line-height:1em;">(consulté le <time class="nowrap" datetime="2025-08-12" data-sort-value="2025-08-12">12 août 2025</time>)</small></span></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><a href="#cite_ref-3">↑</a> </span><span class="reference-text"><span class="ouvrage" id="officielle"><span class="ouvrage" id="Documentation_officielle">Documentation officielle, «&nbsp;<a rel="nofollow" class="external text" href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/"><cite style="font-style:normal;">Introduction to Spring Framework</cite></a>&nbsp;»</span></span></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><a href="#cite_ref-4">↑</a> </span><span class="reference-text"><i>Expert One-on-One J2EE Design and Development</i>,Rod Johnson, Juergen Holler <small style="line-height:1em;">(<a href="International_Standard_Book_Number" title="International Standard Book Number">ISBN</a>&nbsp;<span class="nowrap">978-0-7645-4385-2</span>)</small></span>
</li>
<li id="cite_note-5"><span class="mw-cite-backlink"><a href="#cite_ref-5">↑</a> </span><span class="reference-text"><a rel="nofollow" class="external text" href="http://ego.developpez.com/spring/">ego.developpez.com/spring</a></span>
</li>
</ol></div>
</div>
<div class="mw-heading mw-heading2"><h2 id="Voir_aussi">Voir aussi</h2></div>
<style data-mw-deduplicate="TemplateStyles:r194021218">
/* start https://fr.wikipedia.org/ */


.mw-parser-output .autres-projets>.titre{text-align:center;margin:0.2em 0}.mw-parser-output .autres-projets>ul{margin:0;padding:0}.mw-parser-output .autres-projets>ul>li{list-style:none;margin:0.2em 0;text-indent:0;padding-left:24px;min-height:20px;text-align:left;display:block}.mw-parser-output .autres-projets>ul>li>a{font-style:italic}@media(max-width:720px){.mw-parser-output .autres-projets{float:none}}


/* end https://fr.wikipedia.org/ */
</style>
<div class="mw-heading mw-heading3"><h3 id="Articles_connexes">Articles connexes</h3></div>
<ul><li>Autres framework similaires
<ul><li><a href="Google_Guice" title="Google Guice">Google Guice</a></li>
<li>Apache HiveMind&nbsp;<a href="https://uk.wikipedia.org/wiki/Apache_HiveMind" class="extiw external" title="uk:Apache HiveMind"><span class="indicateur-langue" title="Article en ukrainien&nbsp;: «&nbsp;Apache HiveMind&nbsp;»">(uk)</span></a></li></ul></li></ul>
<ul><li><a href="JHipster" title="JHipster">JHipster</a></li></ul>
<div class="mw-heading mw-heading3"><h3 id="Bibliographie">Bibliographie</h3></div>
<ul><li><i>Spring par la pratique</i> par Julien Dubois, Jean-Philippe Retaillé, Thierry Templier, <a href="Eyrolles" title="Eyrolles">Eyrolles</a>, 2006, 517 p., <small style="line-height:1em;">(<a href="International_Standard_Book_Number" title="International Standard Book Number">ISBN</a>&nbsp;<span class="nowrap">2212117108</span>)</small></li>
<li><i>Spring par l'exemple</i> par Gary Mak, PEARSSON, 2008, 492 p., <small style="line-height:1em;">(<a href="International_Standard_Book_Number" title="International Standard Book Number">ISBN</a>&nbsp;<span class="nowrap">2744023396</span>)</small></li></ul>
<div class="mw-heading mw-heading3"><h3 id="Liens_externes">Liens externes</h3></div>
<ul><li><abbr class="abbr indicateur-langue" title="Langue : anglais">(en)</abbr> <a rel="nofollow" class="external text" href="https://spring.io/">Site officiel du projet Spring</a></li></ul>
<div class="navbox-container" style="clear:both;">

</div>
<ul id="bandeau-portail" class="bandeau-portail"><li><span class="bandeau-portail-element"><span class="bandeau-portail-icone"><span class="noviewer" typeof="mw:File"></span></span> <span class="bandeau-portail-texte">Portail des logiciels libres</span> </span></li> </ul></div><!--htdig_noindex--><div><div class="zim-footer">
Cet article est issu de <a class="external text" title="Dernière modification le 2025-09-12" href="https://fr.wikipedia.org/wiki/?title=Spring_(framework)&amp;oldid=228920180">Wikipédia</a>. Sauf mention contraire, le texte est disponible sous <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.fr">Creative Commons Attribution-Share Alike 4.0</a>. Des conditions supplémentaires peuvent s’appliquer aux fichiers multimédias.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
<script src="./_webp_/webpHandler.js"></script>

</body></html>